﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using WuDada.Core.Post;
using WuDada.Core.Post.Service;
using WuDada.Core.Post.Domain;

public partial class UserControl_MainTopMenu : System.Web.UI.UserControl
{
    private PostFactory m_PostFactory;
    private IPostService m_PostService;

    protected void Page_Load(object sender, EventArgs e)
    {
        m_PostFactory = new PostFactory();
        m_PostService = m_PostFactory.GetPostService();

        if (!IsPostBack)
        {
            FillAboutus();
            FillCase();
            FillService();
        }
    }

    private void FillService()
    {
        IList<NodeVO> subNodeList = m_PostService.GetNodeListByParentId(16);
        RepeaterService.DataSource = subNodeList;
        RepeaterService.DataBind();
    }

    private void FillCase()
    {
        IList<NodeVO> subNodeList = m_PostService.GetNodeListByParentId(10);
        RepeaterCase.DataSource = subNodeList;
        RepeaterCase.DataBind();
    }

    private void FillAboutus()
    {
        Dictionary<string, string> conditions = new Dictionary<string, string>();
        conditions.Add("NodeId", "2");
        conditions.Add("Flag", "1");
        RepeaterAboutus.DataSource = m_PostService.GetPostList(conditions);
        RepeaterAboutus.DataBind();
    }
}